<?php
if ( !defined( "IN_OP" ) )
{
    exit( "You can't access this file directly..." );
}
require_once( "class_3d/CheckMode_3d.php" );
$gametype = intval( getvar( "gametype" ) );
$chkGametype = chkGametype( $gametype );
$chk = new CheckMode_3d( $curruser['acl'], 1, $gametype );
$chk->checkShow3dPage();
$show3D3S = $chk->show3D3S;
$g_betname_3or5 = judge_type( $gametype, true );
if($show3D3S==3)
{
	require_once("class_sb/RateConfig_sb.php");
	$RateConfig=new RateConfig_sb($gametype);	
}

$xyidArr = array( 0 => "", 1 => "X 盘", 2 => "Y盘" );
unset( $chk );
$tbl = $g_gametype_3d[$gametype]['en'];
$tblName = $g_gametype_3d[$gametype]['ch'];
$ui = new UI_3D( true );
$tpl = new Template2();
$today = date( "Y-m-d" );

if ( $conf->get( "calcbet_{$tbl}" ) == 1 )
{
    $ui->showErrorPage( "{$tblName}颁奖过帐中，请稍後再使用本功能！", true );
    exit();
}
else if ( $curruser['enabled'] == 0 || $curruser['enabled'] == 2 )
{
    $ui->showErrorPage( "帐号已被暂停使用" );
    exit();
}
if($show3D3S==3)
{
	include_once( "member_sb/BetChk.php" );
}
else
{
	include_once( "BetChk.php" );
}
$BetChk = new BetChk( $today, $gametype );	
if ( $lotto_3d = $BetChk->chkBetDate( $today ) )
{
    include_once( "class_3d/Bet_3d.php" );
    $Bet_3d = new Bet_3d( $gametype );
    $open = $lotto_3d['open'];
    $round = $lotto_3d['round'];
    $lotto_id = $lotto_3d['id'];
    $list = "";
    $amount = 0;
    $payoff = 0;
    $count = 0;
    $result = $Bet_3d->getMyBetRS( $curruser['id'], $lotto_id );
    while ( $row = mysql_fetch_array( $result, MYSQL_ASSOC ) )
    {
        if ( $gametype == 20 && $row['bettype'] < 9 )
        {
            $xyid = "&nbsp;<font color=\"blue\">".$xyidArr[$row['xyid']]."</font>";
        }
        else
        {
            $xyid = "";
        }
        $list .= "<tr>";
        $list .= "<td nowrap align=left>".$row['id']."</td>";
        $list .= "<td nowrap>".date( "m-d H:i", $row['createtime'] )."</td>";
		if($show3D3S==3)
			$list .= "<td nowrap>".$xyid."【".$g_betname_3or5[$row['bettype']]."】&nbsp;".$RateConfig->getBetContent($row['bettype'],$row['line_nums'])."</td>";
		else
        	$list .= "<td nowrap>".$xyid."【".$g_betname_3or5[$row['bettype']."_".$row['subid']]."】&nbsp;".nl2br( $row['line_nums'] )."</td>";
        $list .= "<td nowrap>".$g_disk_name[$row['disk']]."</td>";
        $list .= "<td nowrap align=left>".floatval( $row['rate'] )."</td>";
        $list .= "<td nowrap align=left>".$row['amount']."</td>";
        if ( $row['rame'] == 1 )
        {
            $list .= "<td nowrap align=center><font color=red>- 逾时 -</font></td>";
        }
        else if ( $row['rame'] == 2 )
        {
            $list .= "<td nowrap align=center><font color=red>- 取消 -</font></td>";
        }
        else if ( $row['rame'] == 3 )
        {
            $list .= "<td nowrap align=center><font color=red>- 异常 -</font></td>";
        }
        else
        {
            $list .= "<td align=left>".$row['payoff']."</td>";
            $amount += $row['amount'];
            $payoff += $row['payoff'];
            ++$count;
        }
        $list .= "</tr>";
    }
    if ( $list == "" )
    {
        $list = "<tr class=\"row1\"><td colspan=\"10\" align=\"center\">没有 ".$tblName." 下注资料！</td></tr>";
    }
    //$tpl->load( "main", "status.htm" );
	$tpl->load( array("menu" => ($gametype==24?'pk':'ssc')."_menu.htm","main" => "status.htm") );
	$tpl->set("gametype",$gametype);
	$tpl->show( "menu" );
    $tpl->set( array( "count" => $count, "sum_amount" => $amount, "sum_payoff" => "", "open" => $open, "round" => $round = d3( $round ), "lotto_id" => $lotto_id, "list" => $list, "gametypeStr" => $tblName, "gametype" => $gametype ) );
    $jslink = "<script src=\"core/tpl/k2/jquery-1.4.2.min.js\"></script>\n";
    $ui->set( "jslink", $jslink );
    $ui->header();
    $ui->showNews3D( $curruser['acl'] ,1 );
    $tpl->show( "main" );
    $ui->footer();
}
echo "\r\n\r\n";
?>